package com.zx.mes.hyl.job;

import lombok.extern.log4j.Log4j2;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * log job
 * @author huayunlong
 * @date 2018-8-31
 */
@Log4j2
@Component
public class LogJob {

    @Scheduled(fixedRate = 2000)
    public void logging(){
        Date now = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        log.info(sdf.format(now));
        log.debug("----------------- DEBUG -----------------");
        log.warn("----------------- WARN -----------------");
        log.error(now.getTime());
    }
}
